<template>
	<view>
		<view class="cu-list grid col-4 no-border">
			<view style="align-items: center;
" class="cu-item" v-for="(item,index) in cuIconList" :key="index" @click="handType(item)">
				<view class="back_img" :style="{backgroundImage:'url('+ item.typeIcon +')'}">
					<view class="cu-tag badge" v-if="item.typeName=='文本下载'" style="top: 10upx;">
						<block>99+</block>
					</view>
					<view v-if="index==0" class="cu-tag badge bg-yellow" style="top: 10upx;">
						<block>推荐</block>
					</view>
				</view>
				<text>{{item.typeName}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cuIconList: [],
			};
		},
		async mounted() {
			this.http.getYuHandleTypeInfo().then(res => {
				console.log(res, 111)
				this.cuIconList = res.data.data
			})
		},
		methods: {
			handType(item) {
				console.log(item)
				if (item.id == 2) {
					uni.showToast({
						title: '尽请期待',
						icon: 'none'
					})
					return
				}
				uni.navigateTo({
					url: '/pages/home/demandForm/demandForm?id=' + item.id,
					fail: function(err) {
						console.info("跳转失败", err)
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.back_img {
		background-repeat: no-repeat;
		background-size: 100%;
		width: 100upx;
		height: 100upx;
	}
</style>
